//
//  RotationGestureView.h
//  AloneInTheLight
//
//  Created by Michael Sherron on 10/4/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <math.h>
#import "AloneInTheLightViewController.h"

#import "SoundController.h"

#include <mach/mach_time.h>

@class AloneInTheLightViewController;

@interface RotationGestureView : UIView

@property (nonatomic, assign) CGPoint origin;
@property (nonatomic, assign) CGPoint startPoint;

@property (nonatomic, assign) long double lastValidTheta;
@property (nonatomic, assign) long double previousTheta;
@property (nonatomic, assign) float totalCircles;
@property (nonatomic, assign) float partialCircles;
@property (nonatomic, assign) BOOL lastValueWasZero;    //zero or Pi are the options for YES and NO respectively
@property (nonatomic, assign) long double finalAverageVelocity;

@property (nonatomic, assign) uint64_t previousTime;
@property (nonatomic, assign) long double velocity;

@property (nonatomic, assign) double conversionToSeconds;
@property (nonatomic, assign) UIImageView *shard;
@property (nonatomic, assign) UIImageView *circleImage;
@property (nonatomic, assign) CABasicAnimation* rotationAnimation;
@property (nonatomic, assign) AloneInTheLightViewController *parent;

@property (nonatomic, retain) UIImageView *rotatingCircle;

@property (nonatomic, assign) BOOL rotationHidden;

//Test sound property
@property (nonatomic, retain) SoundController* soundController;

@property (nonatomic, assign) BOOL isSinging;

- (void)calculateTickToSecondsRatio;
- (void)setupSoundAndCircle;
- (void)hideRotationGesture;
- (BOOL)isHidden;
- (void)revealRotationGesture;

- (double)getDistance: (CGPoint) to andPoint: (CGPoint) from;

@end
